﻿using System;

namespace Silver3D.Math
{
    public struct ColorBgr32
    {
        private short a, r, g, b;

        public byte R { get { return (byte)(r * a / 255); } }
        public byte G { get { return (byte)(g * a / 255); } }
        public byte B { get { return (byte)(b * a / 255); } }

        public int RGB { get { return ((int)R << 16) | ((int)G << 8) | (int)B; } }

        public ColorBgr32(Color4 color)
        {
            a = (short)(color.A * 255.0);
            r = (short)(color.R * 255.0);
            g = (short)(color.G * 255.0);
            b = (short)(color.B * 255.0);
        }

        public ColorBgr32(ColorBgr32 color, byte weight)
        {
            a = (short)(color.a * weight / 255);
            r = color.r;
            g = color.g;
            b = color.b;
        }
    }
}
